<template>
  <div class="patient_main">
    <div class="main" style="padding-bottom: 80px;">
      <div>
        <div class="question">
          <div class="group">
            <div class="group__cells">
              <div class="cells">
                <div class="cell question-base__cell has_border"><!---->
                  <div class="cell__bd">
                    <div class="c-primary" v-if="answer.answer_info.doctor_content != null && answer.answer_info.doctor_content != ''">已回答</div>
                    <div class="c-primary-f" v-else>未回答</div>
                  </div>
                  <div class="cell__ft"><p><span class="c-primary">￥{{ answer.order_info.real_price }}</span>
                    <span v-if="answer.answer_info.is_public === true">公开问题</span>
                    <span v-else>未公开问题</span>
                  </p></div>
                </div>
                <div class="cell doctor__item divert__card cell_access has_border">
                  <div class="cell__hd">
                    <div>
                      <div class="avatar">
                        <div class="img-wp avatar__img"><img :src="answer.doctor_info.avatar">
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="cell__bd">
                    <div class="doctor image-content-distance">
                      <div><h3 class="doctor__name" style="display: inline;"> {{ answer.doctor_info.name }} &nbsp;</h3><span
                          class="doctor__work-info">{{ answer.doctor_info.get_title_display }}</span><!----><!----><span class="doctor__question-price">¥{{ answer.doctor_info.price}}</span>
                      </div>
                      <div class="doctor__work"><span class="doctor__work-info">{{answer.doctor_info.department_name}}</span><span
                          class="doctor__hospital-name"> {{ answer.doctor_info.hospital_name }} </span></div>
                      <div class="doctor__tag-name">
                        <span>擅长：</span>
                        <span v-for="(item, key) in answer.doctor_info.illness">{{ item.name }}&nbsp;</span>
                      </div>

                      <div class="doctor__price-answer">

                        <div class="doctor__star-rank">
                          <span class="doctor__star"> ★ {{ answer.star_answer.star }}</span>
                        </div>
                        <span class="doctor__question-replycount">{{ answer.star_answer.answer }}个回答</span></div>
                      <div>
                        <div class="doctor__remarktags" v-for="(item, key) in answer.doctor_info.label"> {{ item.name }}</div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="question-body">
            <div class="group">
              <div class="group__hd"><p>患者提问</p></div>
              <div class="group__cells">
                <div class="cells">
                  <div class="cell has_border question-body__cell">
                    <div class="cell__bd">
                      <div>
                        <div class="cell-bd__header">
                          <div class="avatar avatar_min">
                            <div class="img-wp avatar__img"></div><img src="../../assets/default.jpg" style="height: 20px;width: 20px;border-radius: 50px;"/>
                            <span class="avatar__name"> 患者 </span></div>
                          <div class="question-body__text"
                               show-patient-img="true"><p>
                            {{ answer.answer_info.user_content }}
                          </p><!---->
                            <div class="question-body__img">
                              <p class="privacy_tip">
                                <img src="../../assets/感叹号.png" class="icon-font icon-warn"/>
                                为保护患者隐私，患者上传的文件仅患者本人和医生可见。
                              </p>
                              <div class="img__wrapper"></div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="question-body__time"> {{ answer.answer_info.create_time }}</div>
                    </div>
                    <div class="cell__ft"></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="group" v-if="answer.answer_info.doctor_content != null && answer.answer_info.doctor_content != ''">
              <div class="group__hd"><p>医生回答</p></div>
              <div class="group__cells">
                <div class="cells">
                  <div class="cell has_border question-body__cell symbol symbol_ok">
                    <div class="cell__bd">
                      <div>
                        <div class="cell-bd__header">
                          <div class="avatar avatar_min">
                            <div class="img-wp avatar__img"><img :src="answer.doctor_info.avatar"></div><!----><span class="avatar__name"> {{ answer.doctor_info.name }} <!----></span></div>
                          <div class="question-body__text"
                               show-patient-img="true">
                            <p>{{ answer.answer_info.doctor_content }}</p>
                            <div class="question-body__img">
                              <div class="img__wrapper"></div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="question-body__time"> {{ answer.answer_info.update_time }}</div>
                    </div>
                    <div class="cell__ft"></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import {ref, watch, onMounted} from "vue";
import {ElMessage, ElMessageBox} from "element-plus";
import pay from "../../api/pay.js";
import { useRouter, useRoute} from "vue-router";
import answer from "../../api/answer.js";
import settings from "../../settings.js";
const router = useRouter()
const route = useRoute()

let answer_id = route.query.answer_id
let doctor_id = route.query.doctor_id
let order_id = route.query.order_id

onMounted(()=>{
  let token = sessionStorage.access_token || localStorage.access_token;
  answer.get_answer_info(token, answer_id, doctor_id, order_id)
  answer.get_star_answer(doctor_id)
})




</script>

<style scoped>
.patient_main {
  background-color: #f4f4f4;
  height: auto;
}
*{
  margin: 0;
  padding: 0;
}
div {
  display: block;
  unicode-bidi: isolate;
}
.main{
  width: 768px;
  min-height: 630px;
  height: 100%;
  margin: 0 auto;
}
.group {
  margin-top: 10px;
}
.cells {
  position: relative;
}
.group__cells .cell {
  padding: 14px 0 14px 4%;
}
.cell, .cell.has_border {
  position: relative;
}
.cell {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  background-color: #fff;
}
.cell__bd {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  overflow: hidden;
}
.c-primary {
  color: #00c792;
}
.cell__ft {
  padding-right: 16px;
  color: #999;
  text-align: right;
}
p {
  display: block;
  margin-block-start: 16px;
  margin-block-end: 16px;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}
.c-primary {
  color: #00c792;
}
.c-primary-f {
  color: gray;
}
.cell.has_border:after {
  position: absolute;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 1px;
  border-top: 1px solid #ebebeb;
  -webkit-transform: scaleY(.5);
  -ms-transform: scaleY(.5);
  transform: scaleY(.5);
  -webkit-transform-origin: 0 100%;
  -ms-transform-origin: 0 100%;
  transform-origin: 0 100%;
  content: "";
}
.cell:after {
  left: 4%;
  width: 96%;
}
.cell.doctor__item {
  -webkit-box-align: initial;
  -webkit-align-items: initial;
  -ms-flex-align: initial;
  align-items: normal;
  padding: 14px 4% 14px 4%;
}
.group__cells .cell .cell__hd {
  font-size: 16px;
}
.cell__hd {
  text-align: center;
}
.avatar {
  position: relative;
  /*text-align: center;*/
}
.img-wp {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  overflow: hidden;
}
.avatar__img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  position: relative;
}
.img-wp img {
  display: block;
  width: 100%;
  height: 100%;
}
img {
  overflow-clip-margin: content-box;
  overflow: clip;
}
.image-content-distance {
  margin-left: 12px;
}
.doctor {
  font-size: 0;
  line-height: 1.15;
}
.doctor__name {
  font-size: 16px;
}
.doctor__work-info {
  display: inline-block;
  color: #666;
  font-size: 13px;
  line-height: 1.15;
}
.doctor__question-price {
  position: absolute;
  top: 15px;
  right: 15px;
  color: #00ad7f;
  font-weight: 500;
  font-size: 15px;
}
.doctor__work, .doctor__work p {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}
.doctor__work {
  margin-top: 8px;
  color: #999;
  font-size: 13px;
}
.doctor__work-info {
  display: inline-block;
  color: #666;
  font-size: 13px;
  line-height: 1.15;
}
.doctor__hospital-name {
  color: #666;
}
.doctor__tag-name {
  margin-top: 8px;
  color: #999;
  font-size: 13px;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}
.doctor__price-answer {
  margin-top: 10px;
}
.doctor__star-rank {
  display: inline-block;
  margin-right: 10px;
}
.doctor__question-replycount {
  color: #666;
  font-size: 12px;
  line-height: 1.15;
  letter-spacing: 1px;
}
.doctor__remarktags {
  display: inline-block;
  margin: 10px 6px 0 0;
  padding: 1px 6px;
  color: #00ad7f;
  font-size: 12px;
  line-height: 1.17;
  border: 1px solid rgba(33, 156, 139, .3);
  border-radius: 50px;
}
.group__hd {
  padding-left: 4%;
  color: #999;
  font-size: 13px;
  line-height: 40px;
}
.cells {
  position: relative;
}
.group__cells .cell {
  padding: 14px 0 14px 4%;
}
.cell, .cell.has_border {
  position: relative;
}
.question-body__cell {
  padding: 14px 0;
}
.cell {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  background-color: #fff;
}
.cell__bd {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  overflow: hidden;
}
.cell-bd__header {
  position: relative;
  padding-bottom: 5px;
}
.avatar_min {
  line-height: 20px;
  text-align: left;
}
.avatar {
  position: relative;
  /*text-align: center;*/
}
.cell-bd__header .avatar__img {
  position: absolute;
  top: 0;
  left: 0;
}
.avatar_min .avatar__img {
  width: 20px;
  height: 20px;
}
.img-wp {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  overflow: hidden;
}
.avatar__img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  position: relative;
}
.img-wp img {
  display: block;
  width: 100%;
  height: 100%;
}
.avatar__img:after {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, .05);
  border-radius: 50%;
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  content: " ";
}
.cell-bd__header .avatar__name {
  width: 70%;
  /*margin-left: 30px;*/
}
.avatar_min .avatar__name {
  display: inline-block;
  max-width: none;
  margin-top: 0;
  font-size: 15px;
}
.avatar__name {
  display: block;
  max-width: 64px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 13px;
  line-height: 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}
.question-body__text {
  margin-top: 13px;
  color: #202020;
  line-height: 22px;
  word-wrap: break-word;
  word-break: break-all;
}
.privacy_tip {
  margin: 12px 0;
  padding: 5px;
  color: #999;
  font-size: 12px;
  background-color: #f3f3f3;
}
.icon-warn {
  color: #ffb300;
}
.icon-font {
  width: 1em;
  height: 1em;
  overflow: hidden;
  vertical-align: -.15em;
  fill: currentColor;
}
.icon-warn:before {
  content: "\EB63";
}
.question-body__img .img__wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  margin-top: 15px;
}
.question-body__time {
  padding: 8px 0 0;
  color: #ccc;
  font-size: 13px;
  line-height: 16px;
  text-align: left;
}


.cell-bd__header .avatar__name {
  width: 70%;
  margin-left: 30px;
}
.avatar_min .avatar__name {
  display: inline-block;
  max-width: none;
  margin-top: 0;
  font-size: 15px;
}
.avatar__name {
  display: block;
  max-width: 64px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 13px;
  line-height: 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: break-all;
}
.doctor__star {
  width: 19.5px;
  height: 15px;
  color: #ffa91f;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.15;
}
.doctor__star-rank {
  display: inline-block;
  margin-right: 10px;
}

</style>